#include <stdio.h>
#include <stdlib.h>
#include <math.h>

#define M 1000
#define step 1000000

int T = 0, N = 0;

int Z(int n)
{
    int i = 0;
    int sum = 0;

    for(i = 5; i <= n; i *= 5)
    {
        sum += (n / i);
    }
    return sum;
}

int main()
{
    //freopen("bin\\debug\\in.txt", "r", stdin);
    int i = 0;

    scanf("%d", &T);
    for(i = 0; i < T; i++)
    {
        scanf("%d", &N);
        printf("%d\n", Z(N));
    }

    return 0;
}
